import React,{ Component } from 'react';
import IndexTop from './IndexTop.js';
import IndexFooter from './IndexFooter.js';
import DemoCenter from './demoCenter.js';
export default class DemoMain extends React.Component{
    constructor(props){
        super();
        let cId = this.getLocationValue("cId");
        let cBelongto = this.getLocationValue("belongto")
        this.state = {
            cId : cId,
            cBelongto: cBelongto
        };
    }
    //获取浏览器上的参数
    getLocationValue(name){
	    let reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
		let r = window.location.search.substr(1).match(reg);
		if(r!=null)return  decodeURI(r[2]); return null;
    }
    render(){
        return (
        	<div>
				<IndexTop />
				<DemoCenter cId={this.state.cId} cBelongto={this.state.cBelongto} />
				<IndexFooter />
			</div>
        );
    }
}
React.render(<DemoMain />, document.getElementById('webDemo'));